package main

import (
	"fmt"
	"github.com/sirupsen/logrus"
	"os"
)

type MyHook1 struct {
}

func (hook MyHook1) Levels() []logrus.Level {
	return logrus.AllLevels
}
func (hook MyHook1) Fire(entry *logrus.Entry) error {
	entry.Data["app"] = "小陈"
	fmt.Println(entry)

	os.OpenFile()
	return nil
}

func main() {
	logrus.SetLevel(logrus.DebugLevel)
	logrus.AddHook(&MyHook1{})

	logrus.Error("错误信息")
	logrus.Warnln("警告信息")
}
